#ifndef IPLUGIN_H
#define IPLUGIN_H
#include <QObject>
#include <QWidget>
#include <QtPlugin>

class IPlugin : public QObject {
    Q_OBJECT
public:
    virtual ~IPlugin() = default;

    // 必须实现的接口
    virtual QString pluginName() const = 0;
    virtual QString version() const = 0;
    virtual QWidget* createUI(QWidget* parent = nullptr) = 0;

    // 槽函数必须声明为纯虚函数
    /*这里的msg是插件消息协议,建议使用json格式,由插件内部决定*/
public slots:
    virtual void sendMessageToPlugin(const QString& msg) = 0;

signals:
    void messageFromPlugin(QString pluginName, const QString& msg);
};

Q_DECLARE_INTERFACE(IPlugin, "com.example.IPlugin/1.0")
#endif // IPLUGIN_H
